function getCookie(c_name)
{
  var i,x,y,cookies=document.cookie.split(";");
  for (i=0;i<cookies.length;i++)
  {
    x=cookies[i].substr(0,cookies[i].indexOf("="));
    y=cookies[i].substr(cookies[i].indexOf("=")+1);
    x=x.replace(/^\s+|\s+$/g,"");
    if (x==c_name){return unescape(y);}
  }
}

function setCookie(c_name,value,exp)
{
  var expDate=new Date();
  expDate.setDate(expDate.getDate() + exp);
  var c_value=escape(value) + ((exp==null) ? "" : "; expires="+expDate.toUTCString());
  document.cookie=c_name + "=" + c_value;
}


/*
    CONTOH BUAD CARA MANGGILNYA....CARA SETNYA JG...JD KLO BS C ARGS K 3 DARI C SETCOOKIE D BUAD NULL AJ BIAR GA ADA EXPIREDNYA...
function checkCookie()
{
  var photo=getCookie("photo");
  if (photo!=null && photo!="")
  {
    alert("Welcome again " + photo);
  }
  else
  {
    photo=prompt("Please enter your photo:","");
    if (photo!=null && photo!="")
    {
      setCookie("photo",photo);           <---INIH NICH YG DI NULL C SETCOOKIENYA
    }
  }*/
}